package blog.sys.utils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import pub.dao.GeneralDao;

/**
 * Created by zzl on 8/23/2016.
 */
@Component
public class UserUtils {

    public boolean reachMaxUserNum() {
        String sql;
        sql = "select count(*) from t_user where profile_filled = 1";
        int registeredUserCount = generalDao.queryValue(Integer.class, sql);
        sql = "select value from t_sys_var where name = 'max_user_num'";
        int maxUserCount = generalDao.queryValue(Integer.class, sql);
        if(registeredUserCount >= maxUserCount) {
            return true;
        }
        return false;
    }

    @Autowired
    private GeneralDao generalDao;
}
